<#include "/WEB-INF/view/inc/inc.html"/>
<@html qmask=0>
<div class="container">
    <div class="row">
        <div class="col-xs-12 col-sm-3 col-md-3 col-lg-3">
            <div class="jumbotron" style="padding: 20px;">
                <h2>计划</h2>

                <p style="margin:0;font-size: 15px;">
                    严格执行<br>
                    不能错过一次<br>
                    记得分享监督。
                </p>
            </div>

        </div>
        <div class="col-xs-12 col-sm-9 col-md-9 col-lg-9">
            <div class="clearfix">
                <h4>计划列表:</h4>
                <@bstabs lis=ltabstype>
                <#if ltabstype??>
                    <#list ltabstype as li>
                        <@bstab id=li.id num=li_index>
                            <@bsuls lis=listmyulmap["listmyul"+li.id] icons='ok,th-list,eye-open,retweet,remove,map-marker' />
                        </@bstab>
                    </#list>
                </#if>
                </@bstabs>
            </div>
            <div class="clearfix">
                <@bstabs lis=ltabs>
                <#if ltabs??>
                    <#list ltabs as li>
                        <@bstab id=li.id num=li_index>
                            <@bstree t=maptree["tree"+li.id] edit=true/>
                        </@bstab>
                    </#list>
                </#if>
                </@bstabs>
            </div>
        </div>

    </div>
    <div class="row">
        <div>teamline</div>
        <div id="teamline"></div>
        <div id="info" style="height: 100px;overflow:scroll;"></div>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        $("#myNav").affix({
            offset: {
                top: 125
            }
        });

        var dddddfunc =function (){
            alert($(this).parent().attr("id"));
            var data = {};
            data["ids"] = $(this).parent().attr("id");
            data["ids1"] = "ddd";
            data["ids2"] = {"dd":1,"ss":"222rr","12":[1,2],"obj":{a:1,b:2,c:3,d:4,f:5,g:6,h:7,i:8,j:9,k:10,l:11}};
            data["ids3"] = [1,2,3];

            ci.debug(data);
        };
        var delfunc =function (){
            var id = $(this).parent().attr("id");
            id = id.replace("id","");
            $.dely(id,"idea");
        };
        var donefunc = function(){
            var id = $(this).parent().attr("id");
            id = id.replace("id","");
            var data = {};
            data["row.id"] = id;
            var idea = $.findy("idea",data,function(idea){
                if(idea['y_idea_status']<10){
                    data["row.y_idea_status"] = 10;
                }else{
                    data["row.y_idea_status"] = 5;
                }
                $.savey("idea",data);
            });
        };
        var retwen = function (){
            //src 为源头 实物：计划 项目，
            //rela 关联 job 评论 人员关系
            var id = $(this).parent().attr("id");
            id = id.replace("id","");
            var data = {"row.y_rela_srcid":id,'row.y_rela_srctable':'t_y_idea'};
            data["row.y_rela_relatable"] = "t_y_job";
            data["row.y_rela_relaid"] = 1;
            data["row.y_rela_type"] = 0;
            if(false){
                data["row.id"] = "";
            }else{
                data["row.id"] = "";
            }
            $.savey("rela",data);
        }

        var listfunc =function (){
            var id = $(this).parent().attr("id");
            id = id.replace("id","");
            qiao.to("${base}/y/c/plan/"+id);
        };

        $(".okclass").kq_bind("click",donefunc,{'title':"完成"});

        $(".map-markerclass").kq_bind("click",function(){
            var id = $(this).parent().attr("id");
            id = id.split("-")[1];
            ci.ajax("/y/c/getobj/yidea",{id:id},function(data){
                qiao.to("${base}/y/c/plan/"+data.y_project_id+"-"+data.y_idea_parentid);
            });
        },{'title':"定位"});

        $(".th-listclass").kq_bind("click",listfunc,{'title':"详细"});
        $(".eye-openclass").kq_bind("click",dddddfunc,{'title':"关注"});
        $(".removeclass").kq_bind("click",delfunc,{'title':"删除"});
        $(".retweetclass").kq_bind("click",retwen,{'title':"重复每天执行"});

        $('ul>li').kq_dbclickedit(function(editid){
            var editval=$("#"+editid).val();//获取更改内容
            $("#"+editid).parent().html(editval); //将点击的td中原内容改为输入的新内容

            var data = {};
            data["row.y_idea_name"] = editval;
            if(editid){
                data["row.id"] = editid.replace("edit_id","");
            }else{
                data["row.id"] = "";
            }
            $.savey("idea",data);
        });
    });

    $(function () {
        var data = [
            {
                'start': new Date(2010, 7, 23),
                'content': 'Conversation<br><img src="/${base}/WUI/timeline/examples/img/comments-icon.png" style="width:32px; height:32px;">'
            },
            {
                'start': new Date(2010, 7, 23, 23, 0, 0),
                'content': 'Mail from boss<br><img src="${base}/WUI/timeline/examples/img/mail-icon.png" style="width:32px; height:32px;">'
            },
            {
                'start': new Date(2010, 7, 24, 16, 0, 0),
                'content': 'Report'
            },
            {
                'start': new Date(2010, 7, 26),
                'end': new Date(2010, 8, 2),
                'content': 'Traject A'
            },
            {
                'start': new Date(2010, 7, 28),
                'content': 'Memo<br><img src="${base}/WUI/timeline/examples/img/notes-edit-icon.png" style="width:48px; height:48px;">'
            },
            {
                'start': new Date(2010, 7, 29),
                'content': 'Phone call<br><img src="${base}/WUI/timeline/examples/img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">'
            },
            {
                'start': new Date(2010, 7, 31),
                'end': new Date(2010, 8, 3),
                'content': 'Traject B'
            },
            {
                'start': new Date(2010, 8, 4, 12, 0, 0),
                'content': 'Report<br><img src="${base}/WUI/timeline/examples/img/attachment-icon.png" style="width:32px; height:32px;">'
            }
        ];

        ci.ajax("/y/c/teamline",null,function(data){
            var reladatalist = [];
            var i = 0;
            for(var d in data){
                var da = data[d];
                var reladata = {};
                if(da['start']){
                    reladata['start'] =  new Date(da['start']);
                }
                if(da['end']){
                    reladata['end'] =  new Date(da['end']);
                }
                var _col = ""
                if(da["status"] == "10"){
                    _col = '<img src="${base}/WUI/timeline/examples/img/3d-3.jpg" style="width:48px; height:48px;">'
                }else{
                    _col = '<img src="${base}/WUI/timeline/examples/img/3d-4.jpg" style="width:48px; height:48px;">'
                }
                reladata['content'] =  _col+da['content'];
                reladatalist[i++] = reladata;
            }
            $("#teamline").kq_teamline(reladatalist);
        });

    });

</script>
<@backtotop/>
</@html>
